package com.cookbook.service.impl;

import com.cookbook.database.data.HistoryMapper;
import com.cookbook.database.model.Cookbook;
import com.cookbook.database.model.History;
import com.cookbook.database.model.User;
import com.cookbook.service.HistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 胡玉斌 on 2017/7/4.
 */

@Service
public class HistoryServiceImpl implements HistoryService{
    @Autowired
    HistoryMapper mapper;

    @Override
    public List<History> select(Integer userid) {
        return mapper.selectWithOffset(userid);
    }
    @Override
    public void insert(Integer userid, Integer cookbookid) {

        mapper.insert(userid,cookbookid);
    }

    @Override
    public Long deleteSelfByHistoryId(Integer user, Integer cookbook) {
        return mapper.deleteWithHistoryIdAndUserId(user,cookbook);
    }
}
